import {api} from "../request/request"

// 推送服务消息
export const pushMessage = (obj) => {
  const data = api({
    url: `miniProgramMessage`,
    method: 'POST',
    data:obj
  })
  return data
}

// 小程序的openid
export const getOpenId = (obj) => {
  const data = api({
    url: `secondTrialLogin?code=${obj.code}`,
    method: 'GET'
  })
  return data
}

// 添加康复成员信息
export const addRecoveryMember = (obj) => {
  const data = api({
    url: `recoveryMember`,
    method: 'POST',
    data:obj
  })
  return data
}

// 添加康复成员病历
export const addMedicalRecord = (obj) => {
  const data = api({
    url: `medicalRecord`,
    method: 'POST',
    data:obj
  })
  return data
}
// 添加康复动作
export const addRecoveryRecord = (obj) => {
  const data = api({
    url: `recoveryRecord`,
    method: 'POST',
    data:obj
  })
  return data
}

// 查询康复成员病历
export const getMedicalRecord = (obj) => {
  const data = api({
    url: `medicalRecord?recoveryMemberInfoId=${obj.recoveryMemberInfoId}`,
    method: 'GET'
  })
  return data
}

// 查询康复成员信息
export const getRecoveryMember = (obj) => {
  const data = api({
    url: `recoveryMember?recoveryMemberInfoId=${obj.recoveryMemberInfoId}&userId=${obj.userId}`,
    method: 'GET'
  })
  return data
}

// 修改康复成员信息
export const patchRecoveryMember = (obj) => {
  const data = api({
    url: `recoveryMember`,
    method: 'PATCH',
    data:obj
  })
  return data
}

// 修改康复成员病历
export const patchMedicalRecord = (obj) => {
  const data = api({
    url: `medicalRecord`,
    method: 'PATCH',
    data:obj
  })
  return data
}

// 获取病史信息
export const getIllnessDictionary = (obj) => {
  const data = api({
    url: `illnessDictionary/disease`,
    method: 'GET'
  })
  return data
}

// 创建微信用户
export const createUser = (obj) => {
  const data = api({
    url: `userInfo/wechat`,
    method: 'POST',
    data:obj
  })
  return data
}

// 获取用户当前信息
export const getUserInfoOpenid = (obj) => {
  const data = api({
    url: `userInfo?kneeMiniprogramOpenId=${obj.kneeMiniprogramOpenId}`,
    method: 'GET'
  })
  return data
}

// 获取用户当前信息
export const getUserInfoUserid = (obj) => {
  const data = api({
    url: `userInfo?userId=${obj.userId}`,
    method: 'GET'
  })
  return data
}

// 获取当前协议
export const getAgreement = (obj) => {
  const data = api({
    url: `agreement?version=${obj.version}`,
    method: 'GET'
  })
  return data
}

// 签署协议
export const signAgreement = (obj) => {
  const data = api({
    url: `agreement/sign`,
    method: 'POST',
    data:obj
  })
  return data
}

// 绑定医患关系
export const bindDoctor = (obj) => {
  const data = api({
    url: `doctor/bind`,
    method: 'POST',
    data:obj
  })
  return data
}

// 查询每日康复计划内容
export const getRehabilitation = (obj) => {
  const data = api({
    url: `rehabilitation/everyday?rehabilitationPlanTemplateId=${obj.rehabilitationPlanTemplateId}`,
    method: 'GET'
  })
  return data
}

// 查询用户关联医生信息
export const getDoctorInfo = (obj) => {
  const data = api({
    url: `doctor/doctorMember?userId=${obj.userId}&recoveryMemberInfoId=${obj.recoveryMemberInfoId}`,
    method: 'GET'
  })
  return data
}

 // 查询患者是否制定康复计划
 export const getToppedPlan = (obj) => {
  const data = api({
    url: `recoveryMember/queryDevelop?doctorId=${obj.doctorId}&medicalRecordId=${obj.medicalRecordId}`,
    method: 'GET'
  })
  return data
}

// 查询当日康复计划明细
export const getTodayPlanDetail = (obj) => {
  const data = api({
    url: `rehabilitation/queryDetail`,
    method: 'POST',
    data:obj
  })
  return data
}

// 完成康复计划
export const completePlan = (obj) => {
  const data = api({
    url: `rehabilitation/completePlan`,
    method: 'POST',
    data:obj
  })
  return data
}

// 查询康复动作记录
export const getActionRecord = (obj) => {
  const data = api({
    url: `recoveryRecord/queryLegRecord`,
    method: 'POST',
    data:obj
  })
  return data
}
// 查询医生提示
export const getPrompt = (obj) => {
  const data = api({
    url: `interactive/queryPrompt?developRehabilitationPlanId=${obj.developRehabilitationPlanId}`,
    method: 'GET'
  })
  return data
}
//提交注意事项
export const submitPrompt = (obj) => {
  const data = api({
    url: `interactive/readPrompt`,
    method: 'PATCH',
    data:obj
  })
  return data
}

// 获取膝盖小程序用户信息
export const getUserInfoKneeInfo = (obj) => {
  const data = api({
    url: `userInfo/kneeInfo?kneeMiniprogramOpenId=${obj.kneeMiniprogramOpenId}`,
    method: 'GET'
  })
  return data
}